package com.dsy.xiangcun_index.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsy.tools.entity.TbUserRole;
import com.dsy.xiangcun_index.mapper.TbUserRoleMapper;
import com.dsy.xiangcun_index.service.ITbUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dsy
 * @since 2023-02-07
 */
@Service
public class TbUserRoleServiceImpl extends ServiceImpl<TbUserRoleMapper, TbUserRole> implements ITbUserRoleService {

    //注入Mapper接口
    @Autowired
    private TbUserRoleMapper userRoleMapper;

    @Override
    public List<TbUserRole> listByUserId(Integer userId) {

        return userRoleMapper.listByUserId(userId);
    }

    @Override
    public boolean saveRole(TbUserRole userRole) {
        return userRoleMapper.saveRole(userRole.getUserId(),userRole.getRoleId());
    }
}
